<?php
class connection {
    function ketnoi($query){
        $ketnoi = mysql_connect('localhost','root','vertrigo');
        mysql_select_db('web',$ketnoi);
        mysql_query('SET character_set_result = utf8',$ketnoi);
        $ret = mysql_query($query) or die('Không có trang nào như vậy');
        return $ret;
    }
    function laydulieu($query){
        $ret = $this->ketnoi($query);
        $data = array();
        while ($row = mysql_fetch_assoc($ret)){
            $data[]=$row;
        }
        return $data;
    }
}